package org.chengyi.model_shop.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.chengyi.model_shop.entity.User;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM user")
    List<User> getUserList();
    @Select("SELECT * FROM user WHERE username like concat('%',#{username},'%')")
    List<User> getUserListByUsername(String username);
    @Delete("DELETE FROM user WHERE id=#{id}")
    int deleteUser(Integer id);
    @Update("UPDATE user SET username=#{username}, password= #{password},email=#{email},phone=#{phone},address=#{address} WHERE id= #{id}")
    int updateUser(User user);
    @Select("SELECT * FROM user WHERE id= #{id}")
    User getById(Integer id);
}
